<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>管理员</title>
    <style>
        div {
            position: absolute;
            top: 30%;
            left: 50%;
            transform: translate(-50%, -50%);
            text-align: center;
        }

        table, tr, th, td {
            border: 1px solid #5fbdcb;
        }

        table {
            border-collapse: collapse;
        }
    </style>
</head>
<body>
<h1>欢迎您！管理员！</h1>
<div>
    <a href="ManagerStore.jsp">管理店铺</a><br>
    <a href="ManagerUser.jsp">管理用户</a><br>
    <a href="Complaint.jsp">查看投诉</a><br>
    <button id="button">退出</button>
</div>
<script src="https://lib.sinaapp.com/js/jquery/2.0.2/jquery-2.0.2.min.js"></script>
<script>
    $(function () {
        $('#button').on('click', function () {
            $.ajax({
                url: "http://localhost:8080/user.do",
                type: "post",
                data: {
                    method: 'logout'
                },
                dataType: "text",
                success: function (data) {
                    if (data === "ok") {
                        window.location.href = '../Login.jsp';
                    } else {
                        alert("系统出错!");
                    }
                }
            })
        })
    })
</script>
</body>
</html>
